<template>
	<view class="home">
		<view class="assistant">
			<view class="fixfix">
				<view class="file_list" v-if="uploadFileList.length > 0">
					<view class="file_item" v-for="(item, index) in uploadFileList" :key="index">
						<!-- <view class="left">
							<image
								:src="item.isSelect ? 'https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/select.png' : 'https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/notselect.png'"
								@click="changeSelect(item)"></image>
						</view> -->
						<view class="right">
							<view class="top">
								<text>{{ item.name }}</text>
								<text style="min-width: 265rpx;text-align: right;">{{ item.time.slice(0, -3) }}</text>
							</view>

							<view class="setting_list">
								<block v-for="(tag, indexx) in item.tags" :key="indexx">
									<view class="setting_item" v-if="tag.text != '打印份数'">
										<text>{{ tag.PCName || tag.PCName || tag.text }}</text>
										<!-- 为选项时 -->
										<view class="right" style="flex-direction: row; justify-content: flex-end;"
											v-if="tag.type == 'choose'">
											<view v-for="(it, tagIndex) in tag.list" :key="tagIndex"
												@click="changeTagSelect2(tag, tagIndex, item, indexx)">
												<view :class="['tags', it.isSelect ? 'is_active' : '']">
													{{ it.PMName || it.PCName || it.PapeTrypeName }}
												</view>
											</view>
										</view>
										<view class="right" style="flex-direction: row; justify-content: flex-end;"
											v-if="tag.type == 'switch'">
											<view v-for="(it, tagIndex) in tag.list" :key="tagIndex"
												@click="changeTagSelect2(tag, tagIndex, item, indexx)">
												<view :class="['tags', it.isSelect ? 'is_active' : '']">
													{{ it.PMName || it.PCName || it.PapeTrypeName }}
												</view>
											</view>
										</view>
										<view v-if="tag.type == 'page'"
											style="display: flex; align-items: center; flex: 1; justify-content: flex-end;">
											<input @blur="changeTag(tag)" type="number" v-model="tag.value"
												style="text-align:center;max-width: 100rpx; border: 1rpx solid #3572fe; " />-<input
												@blur="changeEndTag(tag)"
												style="text-align:center;max-width: 100rpx; border: 1rpx solid #3572fe;"
												type="number" v-model="tag.TrailerPage" />
										</view>
									</view>
								</block>

							</view>
							<view
								style="display: flex; justify-content: flex-end; align-items: center; font-size: 24rpx; margin: 15rpx 0;">
								<uni-number-box v-model="item.copies" /> <text style="margin-left: 10rpx;"> 份</text>
							</view>
							<view class="bottom">
								<text class="price">{{ returnPrice(item) }}</text>
								<view class="status">
									<view class="status_item" @click="check(item)">
										<image src="https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/watch.png"
											mode=""></image>
										<text>预览</text>
									</view>
									<view class="status_item" @click="del(item, index)">
										<image src="https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/delete.png"
											mode=""></image>
										<text>删除</text>
									</view>

								</view>
							</view>
						</view>
					</view>
				</view>
				<block v-else>
					<EmptyBox text="暂无文件哦～"></EmptyBox>
				</block>
				<!-- 全选 -->
				<view class="select_all" v-if="uploadFileList.length > 0">
					<view class="select_all_left">
						<!-- <view class="left">
							<image :src="imageSrc" mode="" @click="changeSelectAll">
							</image>
							<text>全选</text>
						</view> -->
						<text class="select_all_price" v-if="totalPrice == couPrice">￥{{ totalPrice }}</text>
						<text class="select_all_price" v-else>￥{{ couPrice }} <text class="delPrice">￥{{ totalPrice }}</text></text>
					</view>
					<button :class="['print_button', selectedCount == 0 ? 'cantpay' : '']"
						:disabled="selectedCount == 0" @click="printNow">立刻打印({{ selectedCount }})</button>
				</view>
				<!-- 加号 -->
				<view class="plus" @click="showChooseFile = true">
					<image class="plus_img" src="https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/addFileSmall.png"
						mode=""></image>
				</view>
				<!-- 占位盒子 -->
				<view v-if="uploadFileList.length > 0" style="height: 100rpx;"></view>
				<view v-if="uploadFileList.length == 0" style="height: 60rpx;"></view>
			</view>
			<!-- plus的上传文件 -->
			<u-popup :round="10" :show="showChooseFile" @close="showChooseFile = false">
				<chooseFile ref="chooseFile" @fileListAdd="fileListAdd" @showMore="showMore"
					@closeUpLoadPop="closeUpLoadPop"></chooseFile>
			</u-popup>
			<u-popup :round="10" :show="showMoreFile" @close="showMoreFile = false">
				<moreFile></moreFile>
			</u-popup>
		</view>
	</view>
</template>

<script>
import chooseFile from '@/components/chooseFile/chooseFile.vue';
import uploadList from '@/components/uploadList/uploadList.vue';
import util from '@/common/util'
import moreFile from '@/components/moreFile/moreFile';
import {
	mapState
} from 'vuex'
import EmptyBox from '../../components/EmptyBox/EmptyBox.vue';
export default {
	components: {
		// 上传方式
		chooseFile,
		// 上传文件列表
		uploadList,
		// 更多文件
		moreFile
	},
	data() {
		return {
			showFileSetting: false,
			settingList: [],
			settingIndex: 0,
			showChooseFile: false,
			uploadFileList: [], // 上传文件List
			backgroundColor: 'rgba(255, 255, 255, 0)', //顶部背景颜色
			imgList: [],
			user: {}, //个人信息
			userinfo: {}, // 完整的个人信息
			load: false, //是否加载

			bannerList: [ //轮播图
				{
					Banner: 'https://mg-print.oss-cn-shenzhen.aliyuncs.com/upload/1726732855176723.png'
				},

			],
			PageIndex: 1, //页码
			shopList: [], //商品列表
			isMore: true, //是否还有更多
			isNav: false,
			isSelectedAll: false, //文件全选
			shopOption: {},
			chooseData: { //选择纸张属性
				PapeTrypeCode: '',
				PCCode: '',
				PMCode: '',
			},
			addressInfo: '',
			PageSize: 10,
			uploadOption: '',
			selectIndex: '',
			showMoreFile: false,
			scene: 0, //0:为非扫码，其他为扫码进来用户
			isFirst: true,//判断是否是第一次进入
			chooseIndex: null,//点击进入的索引
			couponList: [],
		};
	},
	computed: {
		...mapState(['Refresh']),
		isAllSelect() {
			return this.uploadFileList.every(item => item.isSelect === true);

		},
		selectedCount() {
			return this.uploadFileList.filter(file => file.isSelect).length;
		},
		imageSrc() {
			return this.isSelectedAll ? 'https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/select.png' :
				'https://mg-print.oss-cn-shenzhen.aliyuncs.com/img/notselect.png';
		},
		storeInfo() {
			this.getShopSale()
			return this.$store.state.storeInfo;
		},
		needScand() {
			return this.$store.state.needScand;
		},
		totalPrice() {
			// 计算总价格
			const total = this.uploadFileList
				.filter(file => file.isSelect && file.configure)
				.reduce((total, file) => total + file.price, 0);

			// 向下取整并保留两位小数
			const roundedTotal = Math.floor(total * 100) / 100;

			return roundedTotal.toFixed(2); // 返回保留两位小数的字符串
		},
		couPrice() {
			const num = this.uploadFileList
				.filter(file => file.isSelect && file.configure)
				.reduce((total, file) => total + (file.generalPage * file.copies), 0);
			
			const list = this.couponList
			const discount = list
				.filter(file => num >= file.StartNum && num < file.EndNum)

				
				
			const piceDis = discount.length>0? discount[0].Discount : 10
			
			const price =Number(piceDis) / 10 * this.totalPrice;
			console.log(piceDis,'piceDispiceDis',price);
			return price.toFixed(2)
		},

	},
	watch: {
		isAllSelect(newValue) {
			this.isSelectedAll = newValue;
		},
		storeInfo(newValue) {

		}
	},

	async onShow() {
		let uploadOption = uni.getStorageSync("uploadOption")
		if (uploadOption) {
			console.log('uploadOption', uploadOption);
			this.uploading(uploadOption)
			uni.removeStorageSync('uploadOption')
		}
	},
	onLoad(options) {
		this.chooseIndex = options.index || null
		this.getCouList()
		if (options.isLibrary) {
			this.isFirst = false
		}

		// 事件总线，监听webview事件
		this.$eventBus.$on('pushImg', (item) => {
			console.log('pushImg', item);

			this.uploading(item)
		})
	},
	onReachBottom() {
		// if (this.isMore) {
		// 	this.PageIndex++;
		// 	this.getMsgList();
		// }
	},
	onUnload() {

	},

	onPageScroll(e) {
		const scrollTop = e.scrollTop;
		const maxScrollTop = 100; // 设置最大滚动距离（根据需要调整）
		// 计算背景颜色的透明度
		let alpha = scrollTop / maxScrollTop;
		if (alpha > 1) alpha = 1; // 透明度不超过1
		this.backgroundColor = `rgba(255, 255, 255, ${alpha})`;
	},
	methods: {
		changeTag(e) {
			if (e.value > e.currentPage) {
				e.value = e.currentPage - 1
			}
			if (e.value < 0 || e.value == 0) {
				e.value = 1
			}
		},
		changeEndTag(e) {
			if (e.TrailerPage < e.value) {
				e.TrailerPage = e.value;
			} else if (e.TrailerPage <= 0) {
				e.TrailerPage = e.value;
			} else if (e.TrailerPage < e.value && e.value !== 1) {
				e.value = e.TrailerPage - 1;
			}
			else if (e.TrailerPage > e.currentPage) {
				e.TrailerPage = e.currentPage
			}
		},
		showMore() {
			this.showChooseFile = false
			this.showMoreFile = true
		},
		// 文件上传
		async uploading(obj) {
			uni.showLoading({
				title: `上传中`
			})
			let newReqData = {
				UserID: uni.getStorageSync('user').UserID,
				Shops_ID: this.$store.state.storeInfo.ID,
				DeviceCode: this.$store.state.storeInfo.DeviceCode || null,
				Url: obj?.url,
				FileName: obj?.name || '新文件'
			}
			let res = await this.$api.post('PrintedFiles/SetFiles', newReqData);
			uni.hideLoading();
			if (res.code == 0) {
				this.$pv.msg('上传成功')
				this.closeUpLoadPop()
			} else {
				this.$pv.msg('上传失败')
			}
			this.$emit('fileListAdd', res.data)
			this.fileListAdd(res.data)
		},
		returnPrice(item) {
			// 份数
			let copies = item.copies
			// item.tags.forEach(tag => {
			// 	if (tag.type === "total") {
			// 		copies = tag.value;
			// 	}
			// });
			const result = {};
			// 找出对应配置,
			item.tags.forEach(tag => {
				if (tag.type === 'choose') {
					tag.list.forEach(item => {
						if (item.isSelect) {
							if (tag.text === "纸张类型") {
								result.PapeTrypeCode = item.PapeTrypeCode;
							} else if (tag.text === "色彩") {
								result.PCCode = item.PCCode;
							} else if (tag.text === "单双面") {
								result.PMCode = item.PMCode;
							}
						}
					});
				}
			});
			//找到对应规格的下标
			const indices = this.shopOption.Printing.map((item, index) =>
				(item.PapeTrypeCode === result.PapeTrypeCode &&
					item.PCCode === result.PCCode &&
					item.PMCode === result.PMCode) ? index : -1
			).filter(index => index !== -1);
			if (indices.length == 0) {
				item.configure = false
				return '请选择配置'
			}
			const priceBell = this.shopOption.Printing[indices[0]];
			const isVip = this.shopOption.IsMember;
			const singleOrDoubleSideTag = item.tags.find(tag => tag.text === "单双面");
			let singleSideIsSelect = ''
			let doubleSideIsSelect = ''
			if (singleOrDoubleSideTag) {
				// 获取“单双面”标签中的“list”数组
				const list = singleOrDoubleSideTag.list;

				// 提取“单面”和“双面”的 isSelect 状态
				const singleSide = list.find(item => item.PMName === "单面");
				const doubleSide = list.find(item => item.PMName === "双面");

				singleSideIsSelect = singleSide ? singleSide.isSelect : null;
				doubleSideIsSelect = doubleSide ? doubleSide.isSelect : null;
			} else {

			}
			// 根据是否是会员计算价格
			let price;
			let pageDetail = {}
			item.tags.forEach((item) => {
				if (item.type === 'page') {
					pageDetail.TrailerPage = item.TrailerPage
					pageDetail.value = item.value
				}
			})
			if (isVip) {

				if (priceBell.MemberType === 1) {
					price = priceBell.MembershipPrice * copies * (singleSideIsSelect ? (Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) : Math.ceil(
						(Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) / 2)); // 会员价 * 份数 *页数
				} else if (priceBell.MemberType === 2) {
					price = copies * priceBell.DiscountedPrice * (singleSideIsSelect ? (Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) : Math.ceil((Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) / 2)) // 原价 * 折扣 * 份数
				}
			} else {
				price = priceBell.OriginalPrice * copies * (singleSideIsSelect ? (Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) : Math.ceil((Number(pageDetail.TrailerPage) - Number(pageDetail.value) + 1) / 2)) // 原价 * 份数
			}
			item.price = price
			item.configure = true
			// 向下取整并保留两位小数
			return `￥${(Math.floor(price * 100) / 100).toFixed(2)}`;
		},
		async getShopSale() {
			if (this.$store.state.storeInfo.ID) {
				let res = await this.$api.post("Printing/GetPrinting", {
					Shops_ID: this.$store.state.storeInfo.ID,
					UserID: uni.getStorageSync("user").UserID
				})
				this.shopOption = res.data
				this.getFileList()
			}

		},
		retuenClass(item, index) {
			if (item.PapeTrypeCode == this.chooseData.PapeTrypeCode) {
				return 'is_active';
			} else if (item.PCCode == this.chooseData.PCCode) {
				return 'is_active';
			} else if (item.PMCode == this.chooseData.PMCode) {
				return 'is_active';
			}
			return '';
		},

		changeTagSelect2(tags, tagsIndex, item) {
			this.settingList = item
			// 取消选择所有项目
			tags.list.forEach(item => item.isSelect = false);
			tags.list[tagsIndex].isSelect = true;
			const result = {};

			// 遍历设置列表中的所有标签
			this.settingList.tags.forEach(tag => {
				if (tag.type === 'choose') { // 只处理类型为 'choose' 的标签
					tag.list.forEach(item => {
						if (item.isSelect) { // 如果项目被选择
							// 根据标签的文本类型，将相应的值存储到 result 对象中
							if (tag.text === "纸张类型") {
								result.PapeTrypeCode = item.PapeTrypeCode;
							} else if (tag.text === "色彩") {
								result.PCCode = item.PCCode;
							} else if (tag.text === "单双面") {
								result.PMCode = item.PMCode;
							}
						}
					});
				}
			});

			// 获取所有符合条件的选项
			const selectedItems = this.settingList.tags
				.filter(tag => tag.type === 'choose') // 只处理类型为 'choose' 的标签
				.flatMap(tag => tag.list.filter(item => {
					// 确定项目是否应该被选中
					const shouldSelect = this.shopOption.Printing.some(printItem =>
						(!result.PapeTrypeCode || printItem.PapeTrypeCode === result.PapeTrypeCode) &&
						(!result.PCCode || printItem.PCCode === result.PCCode) &&
						(!result.PMCode || printItem.PMCode === result.PMCode)
					);
					// 检查项目是否匹配标签的条件
					const matchesTag = (
						(tag.text === "纸张类型" && item.PapeTrypeCode === result.PapeTrypeCode) ||
						(tag.text === "色彩" && item.PCCode === result.PCCode) ||
						(tag.text === "单双面" && item.PMCode === result.PMCode)
					);
					return shouldSelect && matchesTag; // 返回是否应当选择该项目
				}));
			if (selectedItems.length == 0) {
				uni.showToast({
					title: `门店暂不支持此搭配打印，请重新选择`,
					icon: `none`
				})
			}
			// 更新每个标签中的项目选择状态
			this.settingList.tags.forEach(tag => {

				if (tag.type === 'choose') {
					tag.list.forEach(item => {
						// 更新项目的选择状态

						item.isSelect = selectedItems.includes(item);
					});
				}
			});

		},

		check(item) {
			if (item.FileType == "TXT") {
				// const fs = uni.getFileSystemManager();
				// try {
				// 读取文件内容
				// const data = fs.readFileSync(item.Url, 'utf8');
				// 打开一个 WebView 来预览内容
				uni.navigateTo({
					url: `/pages/otherPage/preview?content=${encodeURIComponent(item.Url)}`
				});
				// } catch (err) {
				//    
				// }
				return
			}
			if (item.FileType == 'Img') {
				let imgsArray = [];
				imgsArray[0] = item.Url
				uni.previewImage({
					current: 0,
					urls: imgsArray,
				});

			} else {
				uni.showLoading({
					title: `正在打开文件`
				})
				uni.downloadFile({
					url: item.Url,
					success: function (res) {

						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							showMenu: true,
							success: function (res) {
								uni.hideLoading()
							}
						});
					}
				});
			}


		},
		del(item, index) {
			let that = this
			uni.showModal({
				title: '提示',
				content: `确定将"${item.name}"从列表中删除`,
				success: async function (res) {
					if (res.confirm) {
						let del = await that.$api.post('PrintedFiles/DeleteFile', {
							FileCode: item.FileCode
						})
						if (del.code == 0) {
							that.uploadFileList.splice(index, 1)
							that.$pv.msg('删除成功')
						} else {
							that.$pv.msg('删除失败，请刷新重试')
						}

					}

				}
			});
		},
		changeSelectAll() {
			// 全选反选
			this.isSelectedAll = !this.isSelectedAll
			this.uploadFileList.forEach((item) => {
				item.isSelect = this.isSelectedAll
			})
		},
		changeSelect(item) {

			item.isSelect = !item.isSelect
		},
		fileListAdd(file) {
			const tagTypes = {
				PcData: '色彩',
				PmData: '单双面',
				PtData: '纸张类型'
			};

			let tags = [];

			Object.entries(this.shopOption).forEach(([key, value]) => {
				if (tagTypes[key]) {
					tags.push({
						type: 'choose',
						text: tagTypes[key],
						list: value.map((item, index) => ({
							...item,
							isSelect: index == 0 ? true : false // 将第0项的 isSelect 设置为 true，其余项为 false
						}))
					});
				}
			});

			tags.push({
				type: 'total',
				text: '打印份数',
				value: 1,
				list: [{}]
			});
			// tags.push({
			// 	type: 'switch',
			// 	text: '打印方式',
			// 	value: 1,
			// 	list: [{
			// 		PapeTrypeName:'纵向',
			// 		isSelect:true
			// 	},{
			// 		PapeTrypeName:'横向',
			// 		isSelect:false
			// 	}]
			// });

			tags.push({
				type: 'page',
				text: '打印页数',
				list: [{}],
				value: 1,
				TrailerPage: file?.GeneralPage ? file.GeneralPage : 1,
				currentPage: file?.GeneralPage ? file.GeneralPage : 1,
			});
			console.log(file, 'filefilefile');


			this.uploadFileList.push({
				name: `${file?.FileName.length > 15 ? file?.FileName.substring(0, 15) : file?.FileName}.${file?.Suffix}`,
				type: file?.Suffix,
				time: file?.UploadDate.replace('T', ' '),
				Url: file?.Url,
				generalPage: file?.GeneralPage == 0 ? 1 : file?.GeneralPage,
				isSelect: true,
				tags,
				price: 0,
				FileCode: file?.FileCode,
				configure: true,
				FileType: file?.FileType,
				copies: 1,
				isThrottled: '',
			});
		},
		async getFileList() {
			this.uploadFileList = [] //清空文件列表，再次发起请求，避免数据不对
			let res = await this.$api.post('PrintedFiles/GetFiles')
			res.data.forEach((item) => {
				this.fileListAdd(item)
			})
			if (this.isFirst && res.data.length <= 0) {
				console.log(123333);

				this.isFirst = false
				this.$refs.chooseFile.chooseUploadWay(this.chooseIndex)
			}

		},
		async printNow() {
			if (this.$store.state.storeInfo.IsState === 'false') {
				uni.showToast({
					title: `门店离线，请选择其他门店打印`,
					icon: 'none'
				});
				return;
			}

			// 节流逻辑
			if (this.isThrottled) {
				return; // 如果在节流时间内，直接返回
			}
			this.isThrottled = true; // 设置为正在执行

			setTimeout(() => {
				this.isThrottled = false; // 重置为可以执行
			}, 3000); // 设定节流时间为 3 秒

			try {

				// 生成结果数组
				const arr = this.uploadFileList
					.filter(item => item.isSelect && item.configure) // 过滤出已选择的文件
					.map(item => {
						const obj = {}; // 存储每个文件的处理结果
						const obj2 = {}; // 用于存储标签的选择结果
						obj.Number = item.copies;
						item.tags.forEach(tag => {
							if (tag.type === 'choose') {
								tag.list.forEach(itm => {
									if (itm.isSelect) {
										// 根据标签文本类型存储相应的值到 obj2 中
										switch (tag.text) {
											case "纸张类型":
												obj2.PapeTrypeCode = itm.PapeTrypeCode;
												break;
											case "色彩":
												obj2.PCCode = itm.PCCode;
												break;
											case "单双面":
												obj2.PMCode = itm.PMCode;
												break;
										}
									}
								});

								// 查找匹配的打印选项
								const matchingOption = this.shopOption.Printing.find(printItem =>
									printItem.PapeTrypeCode === obj2.PapeTrypeCode &&
									printItem.PCCode === obj2.PCCode &&
									printItem.PMCode === obj2.PMCode
								);

								if (matchingOption) {
									obj.PrintPCode = matchingOption.PrintPCode;
								}
							}
							if (tag.type === 'page') {
								obj.StartPage = tag.value
								obj.TrailerPage = tag.TrailerPage
							}
							if (tag.type === 'switch') {
								obj.Landscape = !tag.list[0].isSelect
							}
						});

						// 填充额外的字段
						obj.ShopID = this.$store.state.storeInfo.ID; // 店铺ID
						obj.DeviceCode = this.$store.state.storeInfo.DeviceCode; // 设备编码
						obj.FileCode = item.FileCode; // 文件编码
						obj.Price = item.price; // 文件价格
						obj.pageCount = item.generalPage; // 页数
						obj.Delivery_Province = this.addressInfo ? this.addressInfo.result.address_component
							.province : ''; // 省份
						obj.Delivery_City = this.addressInfo ? this.addressInfo.result.address_component.city :
							''; // 城市
						obj.CompanyID = 7006;
						return obj;
					});

				// 处理结果数组
				if (arr.length > 0) {
					const res = await this.$api.post('Order/SetPrintOrder', arr);
					this.pay(res.data);
				} else {
					uni.showToast({
						title: '打印出错, 请重试',
						icon: 'none'
					});
				}
			} catch (error) {
				uni.showToast({
					title: '打印出错, 请重试',
					icon: 'none'
				});
				console.error('打印出错:', error); // 捕获并打印错误
			}
		},

		async pay(data) {
			let pres = await this.$api.post('/Polymerization/PayVJUhe', {
				body: data.EventType,
				ShopsID: this.$store.state.storeInfo.ID,
				EventType: data.EventType,
				EventID: data.EventID,
				CompanyID: 7006,
				SourcePage: '/pages/tab/home',

				// // #ifdef MP-WEIXIN
				// PayChannel: 'weixin',
				// // #endif
				// // #ifdef APP
				// PayChannel: 'app'
				// // #endif
			});

			let _this = this;
			let payObj = pres.data;

			uni.requestPayment({
				provider: 'wxpay',
				// #ifdef APP
				orderInfo: payObj,
				// #endif
				// #ifdef MP-WEIXIN
				timeStamp: payObj.timeStamp,
				nonceStr: payObj.nonceStr,
				package: payObj.package,
				signType: payObj.signType,
				paySign: payObj.paySign,
				// #endif
				success: async function (res) {
					_this.$pv.msg('支付成功');
					setTimeout(() => {
						// _this.closeAlert()
						// _this.upDateInfo();
					}, 500);

					_this.getFileList()
					// _this.nav_back(2000);
				},
				fail: function (err) {
					_this.$pv.msg('您已取消支付');

				}
			});
		},
		// 关闭遮照弹窗
		closeUpLoadPop() {
			this.showChooseFile = false
		},
		// 获取优惠设置
		async getCouList() {
			let res = await this.$api.post('Printing/GetPromotion', {
				ShopID: this.$store.state.storeInfo.ID
			})
			this.couponList = res.data
		},

	}
};
</script>

<style lang="scss" scoped>
.confin {
	margin: 0 auto !important;
	border-radius: 50rpx !important;
}

.setting_list {

	display: flex;
	flex-direction: column;
	padding: 0rpx;

	.setting_item {

		.tags {
			padding: 5rpx 30rpx;
			box-sizing: content-box;
			border-radius: 40rpx;
			border: 1rpx solid #e7e7e7;
			margin-left: 15rpx;
		}

		.is_active {
			color: white;
			background-color: #3572fe;
		}

		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 100rpx;
		border-bottom:1rpx solid #eeeeee;

		.right {
			display: flex;
			align-items: center;

		}
	}

}

.poup_container {
	box-sizing: border-box;
	padding: 30rpx;
	position: relative;


}

.plus {
	display: flex;
	justify-content: center;
	align-items: center;
	position: fixed;
	bottom: 120rpx;
	height: 100rpx;
	width: 100rpx;
	right: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: #3572fe;
	border-radius: 50%; // 使用百分比来简化圆形样式
	border: 5rpx solid white;
	box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(194, 202, 216, 0.31);

	.plus_img {
		width: 100%;
		height: 100%;
	}

}

.print_button {
	height: 100%;
	width: 250rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	background-color: #0d78fa;
	font-size: 28rpx;
}


.select_all {
	padding-bottom: env(safe-area-inset-bottom);
	box-sizing: content-box;

	.select_all_price {
		font-size: 40rpx;
		font-weight: bold;
		margin-left: 30rpx;
		color: red;
		.delPrice{
			text-decoration: line-through;
			font-size: 34rpx;
			color: #999999;
			font-weight: 500;
			margin-left: 10rpx;
		}
	}

	.select_all_left {
		display: flex;
		align-items: center;

		.left {
			display: flex;
			align-items: center;

			image {
				width: 40rpx;
				height: 40rpx;
				margin-right: 10rpx;
			}
		}
	}



	.cantpay {
		background-color: #e6e6eb;
	}

	display: flex;
	align-items: center;
	position: fixed;
	bottom: 0;
	height: 100rpx;
	padding-left: 20rpx;
	width: 100%;
	justify-content: space-between;
	z-index: 99;
	background-color: #ffffff;
}

.file_list {
	image {
		width: 30rpx;
		height: 30rpx;
		margin-right: 10rpx;
	}

	display: flex;
	flex-direction: column;
	padding: 20rpx;
	// background-color: #f5f6f7;
	margin-top: 20rpx;

	.file_item {
		margin-bottom: 20rpx;
		border-radius: 20rpx;
		background-color: #ffffff;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.08);
		border-radius: 16rpx;

		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 30rpx;
			margin-bottom: 20rpx;
		}

		.center {
			font-size: 26rpx;
			display: flex;
			margin: 10rpx 0;
			justify-content: space-between;
			align-items: center;

			.tag {
				padding: 5rpx 20rpx;
				box-sizing: content-box;
				background-color: #f5f5f7;
				margin-right: 10rpx;
				border-radius: 50rpx;
			}
		}

		.bottom {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 20rpx;

			.price {
				color: red;
				font-weight: bold;
			}

			.status {
				display: flex;
				align-content: center;
			}

			.status_item {
				display: flex;
				align-items: center;
				margin-right: 20rpx;

				text {
					font-size: 26rpx;
				}
			}
		}

		display: flex;
		justify-content: space-around;
		align-items: center;
		padding: 20rpx;
	}

	.left {
		display: flex;
		align-items: center;

		image {
			width: 40rpx;
			height: 40rpx;
		}
	}

	.right {
		display: flex;
		justify-content: space-between;
		flex-direction: column;
		flex: 1;
		margin-left: 20rpx;
	}
}

.swiper_contanier {
	width: 702rpx;
	margin: 0 auto;
	height: 300rpx;
}

.block_box {
	height: 196rpx;
}

.img_box {
	position: absolute;
	width: 100%;
	height: 500rpx;
	top: 0;

	image {
		width: 100%;
		height: 100%;
	}
}

page {
	background-color: #ffffff;
}


view {
	box-sizing: border-box;
}

.logo {
	box-sizing: border-box;
	height: 44px;
	width: 750rpx;
	// background: #ffffff;
	position: relative;
	display: flex;
	align-items: center;

	>image {
		position: absolute;
		left: 24rpx;
		bottom: 0;
		width: 30%;
		height: 90%;
	}

	.changeCompanyBox {
		padding: 18rpx 36rpx;
		border-radius: 36rpx;
		display: flex;
		align-items: center;

		text {
			font-weight: bold;
			font-size: 36rpx;
			color: #000000;
		}

	}
}

.assistant {
	position: relative;
	padding-bottom: 150rpx;
	// height: 100vh;
	// overflow: hidden;
}

.fix {
	position: fixed;
	width: 750rpx;
	top: 0;
	left: 0;
	z-index: 98;
	// background-color: #fff;
}
</style>